package com.fdsc.erp.controller;

import com.fdsc.erp.entity.CustomerEntity;
import com.fdsc.erp.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("customer")
public class CustomerController {
    @Autowired
    CustomerService customerService;
    @RequestMapping("add")
    public String addCustomer( CustomerEntity customerEntity) {
        try {
            System.out.println(customerEntity.toString());
            customerService.addCustomer(customerEntity);
        } catch (Exception e) {
            e.printStackTrace();
            return "error";
        }
        return "success";
    }
}
